package org.bmind.datasword.config.dto;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

import org.bmind.datasword.utils.EqualsUtil;
import org.bmind.datasword.utils.StorageUtilities;



/**
 * 
 * @author valerio
 *
 */
public abstract class DObjCommon extends DObjIdentity  implements Serializable {
	
	static { StorageUtilities.addREngineType(DObjCommon.class); }

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	Collection<String> Library = new ArrayList<String>(); // Lista delle librerie da precaricare in R
	//Map<String,DFunctionParameters> fParameter = new HashMap<String,DFunctionParameters>();
	Collection<DConfigFunctionParameters> fParameter = new ArrayList<DConfigFunctionParameters>();

	String name = null;
	String hint = null;
	String label = null;
	Boolean visible = false;
	Boolean exec = false;
	String dFunction = null;
	DEngineType dEngineType= null;
	
	public DObjCommon() {}

	public Collection<String> getLibrary() {return Library;}
	public void setLibrary(Collection<String> library) {Library = library;}

	public String getName() {return name;}
	public void setName(String name) {this.name = name;}

	public String getHint() {return hint;}
	public void setHint(String hint) {this.hint = hint;}

	public String getLabel() {return label;}
	public void setLabel(String label) {this.label = label;}

	public Boolean getVisible() {return visible;}
	public void setVisible(Boolean visible) {this.visible = visible;}

	public Boolean getExec() {return exec;}
	public void setExec(Boolean exec) {this.exec = exec;}

	public String getFunction() {return dFunction;}
	public void setFunction(String dFunction) {this.dFunction = dFunction;}

	public DEngineType getEngineType() {	return dEngineType;}
	public void setEngineType(DEngineType dEngineType) {this.dEngineType = dEngineType;}
	
	/*public Map<String, DFunctionParameters> getfParameter() {return fParameter;}
    public void setfParameter(Map<String, DFunctionParameters> fParameter) {this.fParameter = fParameter;}*/
	
	public Collection<DConfigFunctionParameters> getfParameter() {return fParameter;}
    public void setfParameter(Collection<DConfigFunctionParameters> fParameter) {this.fParameter = fParameter;}
    
    
    /* (non-Javadoc)
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj) {
	   
    	  if ( this == obj ) return true;

    	    if ( !(obj instanceof DObjCommon) ) return false;
     	    DObjCommon dOCom = (DObjCommon)obj;
    	    return
    	      EqualsUtil.areEqual(this.name, dOCom.name) &&
    	      EqualsUtil.areEqual(this.label, dOCom.label) &&
    	      EqualsUtil.areEqual(this.hint, dOCom.hint) &&
    	      EqualsUtil.areEqual(this.exec, dOCom.exec) &&
    	      EqualsUtil.areEqual(this.dEngineType, dOCom.dEngineType) &&
    	      EqualsUtil.areEqual(this.visible, dOCom.visible) &&
    	      EqualsUtil.areEqual(this.hint, dOCom.hint) &&
    	      EqualsUtil.areEqual(this.dFunction, dOCom.dFunction) ;
    	      
    	      
    	    //  Arrays.deepEquals(this.fParameter, dOCom.fParameter);
    	
    	
    	
	    
    }

	

	/* (non-Javadoc)
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
	    // TODO Auto-generated method stub
	    return super.hashCode();
    }

}
